package com.cnap.multiclouldmgmt.service;

import com.cnap.multiclouldmgmt.model.RepByPage;
import com.cnap.multiclouldmgmt.model.gpu.MicroSvcGpuInfoModel;
import com.cnap.multiclouldmgmt.model.gpu.NodeQueryModel;
import com.cnap.multiclouldmgmt.model.k8sModels.SvcModel;
import com.cnap.multiclouldmgmt.model.microSvc.*;
import com.cnap.multiclouldmgmt.model.microSvc.alg.CpuRiskTrendModel;
import com.cnap.multiclouldmgmt.model.microSvc.alg.ForececastRiskCpuModel;
import com.cnap.multiclouldmgmt.model.microSvc.alg.IndicatorHistoryModel;

import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.List;

/**
 * @author dyq
 * 微服务相关
 */
public interface MicroSvcInfoService {

    /**
     *
     * @param cloudVendor
     * @param regionId
     * @param zoneId
     * @param clusterName
     * @param microSvcName
     * @param userName
     * @return
     */
    List<SvcModel> getAllSvcModelForMicroSvc(String cloudVendor,String regionId,String zoneId,String clusterName,String microSvcName,String userName);

    /**
     *
     * @param cloudVendor
     * @param regionId
     * @param zoneId
     * @param clusterName
     * @param microSvcName
     * @param userName
     * @return
     */
    List<String> getAllmicroSvcName(String cloudVendor,String regionId,String zoneId,String clusterName,String microSvcName,String userName);

    /**
     *
     * @param cloudVendor
     * @param regionId
     * @param zoneId
     * @param clusterName
     * @param microSvcName
     * @param userName
     * @return
     */
    List<ClusterMicroSvcModel> getClusterMicroSvcInfos(String cloudVendor, String regionId, String zoneId, String clusterName, String microSvcName, String userName);

    /**
     *
     * @param cloudVendor
     * @param regionId
     * @param zoneId
     * @param clusterName
     * @param microSvcName
     * @param userName
     * @return
     */
    MicroSvcUseInfoModel getMicroSvcUseInfo(String cloudVendor, String regionId, String zoneId, String clusterName, String microSvcName, String userName);

    /**
     *
     * @param k8sClusterName
     * @param microSvcNames
     * @return
     */
    AlarmSvcInfoModel getMicroSvcsInfo(String k8sClusterName, List<String> microSvcNames,String userName);

    /**
     * 获取微服务最近的cpu使用率，mem使用率
     * @param k8sClusterName
     * @param microSvcId
     * @return
     */
    MicroSvcDataSaveModel getMicroSvcDataNow(String k8sClusterName, String microSvcId);

    /**
     * 获取某个微服务最近一小时的平均响应时间
     * @param microSvcId
     * @return
     */
    MicroSvcReqCostInfoModel getMicroSvcReqCostLastHour(String microSvcId);

    /**
     * 保存某个微服务的指标
     * @param microSvcId
     */
    void getAndSaveMicroSvcHistoryModel(String microSvcId);

    /**
     *
     * @param indicatorId
     * @return
     */
    List<IndicatorHistoryModel> getIndicatorHistoryModels(String indicatorId);

    /**
     *
     * @param microSvcId
     * @return
     */
    ForececastRiskCpuModel getCpuRishTrends(String microSvcId);

    /**
     * v2.0
     * 删除服务，
     * 检查是不是部署在master上，
     * 部署在master上要做删除动作
     * 要删除节点
     * @param svcName 微服务名称
     * @param k8sClusterName 集群名称
     * @param svcId svcId
     */
    void delMicroSvc(String svcName,String k8sClusterName,String svcId) throws Exception;

    /**
     * 获取消息
     * @param userName
     * @param pageSize
     * @param pageNo
     * @return
     */
    RepByPage<MsgInfo> getMsgCenterInfos(String userName, int pageSize, int pageNo);

    void delMsgCenterInfo(int id);

    NodeQueryModel queryResInfo(NodeQueryModel nodeQueryModel) throws Exception;

    MicroSvcGpuInfoModel queryGpuHeat(MicroSvcGpuInfoModel microSvcGpuInfoModel);

    void delIndictorHistory(String svcId);

    AlarmNodeInfoModel getAlarmNodeInfo(NodeAlarmReqInfoModel nodeAlarmReqInfoModel);
}
